<!DOCTYPE html>
<html lang="zh-CN">





<head>
  <meta charset="UTF-8">
  <link rel="apple-touch-icon" sizes="76x76" href="/img/apple-touch-icon.png">
  <link rel="icon" type="image/png" href="/img/favicon.png">
  <meta name="viewport"
        content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, shrink-to-fit=no">
  <meta http-equiv="x-ua-compatible" content="ie=edge">
  
  <meta name="theme-color" content="#2f4154">
  <meta name="description" content="">
  <meta name="author" content="xu wen liu">
  <meta name="keywords" content="">
  <title>Taro 采坑指南 - NeverGiveUpT</title>

  <link  rel="stylesheet" href="https://cdn.staticfile.org/font-awesome/5.12.1/css/all.min.css" />
<link  rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/4.4.1/css/bootstrap.min.css" />
<link  rel="stylesheet" href="https://cdn.staticfile.org/mdbootstrap/4.13.0/css/mdb.min.css" />
<link  rel="stylesheet" href="https://cdn.staticfile.org/github-markdown-css/3.0.1/github-markdown.min.css" />

<link rel="stylesheet" href="//at.alicdn.com/t/font_1067060_qzomjdt8bmp.css">



  <link  rel="stylesheet" href="/lib/prettify/tomorrow-night-eighties.min.css" />

<link  rel="stylesheet" href="/css/main.css" />


  <link defer rel="stylesheet" href="https://cdn.staticfile.org/fancybox/3.5.7/jquery.fancybox.min.css" />


<!-- 自定义样式保持在最底部 -->

  
<link rel="stylesheet" href="/css/custom.css">



<meta name="generator" content="Hexo 4.2.0"></head>


<body>
  <header style="height: 70vh;">
    <nav id="navbar" class="navbar fixed-top  navbar-expand-lg navbar-dark scrolling-navbar">
  <div class="container">
    <a class="navbar-brand"
       href="/">&nbsp;<strong>NeverGiveUpT</strong>&nbsp;</a>

    <button id="navbar-toggler-btn" class="navbar-toggler" type="button" data-toggle="collapse"
            data-target="#navbarSupportedContent"
            aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
      <div class="animated-icon"><span></span><span></span><span></span></div>
    </button>

    <!-- Collapsible content -->
    <div class="collapse navbar-collapse" id="navbarSupportedContent">
      <ul class="navbar-nav ml-auto text-center">
        
          
          
          
          
          <li class="nav-item">
            <a class="nav-link" href="/">首页</a>
          </li>
        
          
          
          
          
          <li class="nav-item">
            <a class="nav-link" href="/archives/">归档</a>
          </li>
        
          
          
          
          
          <li class="nav-item">
            <a class="nav-link" href="/categories/">分类</a>
          </li>
        
          
          
          
          
          <li class="nav-item">
            <a class="nav-link" href="/tags/">标签</a>
          </li>
        
          
          
          
          
          <li class="nav-item">
            <a class="nav-link" href="/about/">关于</a>
          </li>
        
          
          
          
          
          <li class="nav-item">
            <a class="nav-link" href="/links/">友链</a>
          </li>
        
        
          <li class="nav-item" id="search-btn">
            <a class="nav-link" data-toggle="modal" data-target="#modalSearch">&nbsp;&nbsp;<i
                class="iconfont icon-search"></i>&nbsp;&nbsp;</a>
          </li>
        
      </ul>
    </div>
  </div>
</nav>

    <div class="view intro-2" id="background" parallax=true
         style="background: url('/img/post.jpg') no-repeat center center;
           background-size: cover;">
      <div class="full-bg-img">
        <div class="mask rgba-black-light flex-center">
          <div class="container text-center white-text fadeInUp">
            <span class="h2" id="subtitle">
              
            </span>

            
              
                <p class="mt-3 post-meta">
                  <i class="fas fa-calendar-alt" aria-hidden="true"></i>
                  2020-03-12 16:00:00
                </p>
              

              <p class="mt-1">
                
                  
                  <span class="post-meta">
                    <i class="far fa-chart-bar"></i>
                    1.3k 字
                  </span>
                

                
                  
                  <span class="post-meta">
                      <i class="far fa-clock"></i>
                      6 分钟
                  </span>
                

                
              </p>
            
          </div>

          
        </div>
      </div>
    </div>
  </header>

  <main>
    
      

<div class="container-fluid">
  <div class="row">
    <div class="d-none d-lg-block col-lg-2"></div>
    <div class="col-lg-8 nopadding-md">
      <div class="container nopadding-md" id="board-ctn">
        <div class="py-5 z-depth-3" id="board">
          <div class="post-content mx-auto" id="post">
            
              <p
                class="note note-warning">本文最后更新于：2020-05-02 23:15:01</p>
            
            <div class="markdown-body">
              <h3 id="在Taro中如何正确给自定义组件传递样式类"><a href="#在Taro中如何正确给自定义组件传递样式类" class="headerlink" title="在Taro中如何正确给自定义组件传递样式类"></a>在Taro中如何正确给自定义组件传递样式类</h3><p>需要利用 externalClasses 定义段定义若干个外部样式类。这个特性从小程序基础库版本 1.9.90 开始支持。</p>
<pre><code class="js">/* CustomComp.js */
export default class CustomComp extends Component {
  static externalClasses = [&#39;my-class&#39;]

  render () {
    return &lt;View className=&quot;my-class&quot;&gt;这段文本的颜色由组件外的 class 决定&lt;/View&gt;
  }
}
</code></pre>
<pre><code class="js">/* MyPage.js */
export default class MyPage extends Component {
  render () {
    return &lt;CustomComp my-class=&quot;red-text&quot; /&gt;
  }
}
</code></pre>
<pre><code class="scss">/* MyPage.scss */
.red-text {
  color: red;
}
</code></pre>
<p>注意：externalClasses 需要使用 短横线命名法 (kebab-case)，而不是 React 惯用的 驼峰命名法 (camelCase)。否则无效。</p>
<h3 id="父组件的样式类完全影响子组件"><a href="#父组件的样式类完全影响子组件" class="headerlink" title="父组件的样式类完全影响子组件"></a>父组件的样式类完全影响子组件</h3><p>使用外部样式类可以让组件使用指定的组件外样式类，如果希望组件外样式类能够完全影响组件内部，可以将组件构造器中的 options.addGlobalClass 字段置为 true。这个特性从小程序基础库版本 2.2.3 开始支持。</p>
<pre><code class="js">/* CustomComp.js */
export default class CustomComp extends Component {
  static options = {
    addGlobalClass: true
  }

  render () {
    return &lt;View className=&quot;red-text&quot;&gt;这段文本的颜色由组件外的 class 决定&lt;/View&gt;
  }
}</code></pre>
<pre><code class="css">/* 组件外的样式定义 */
.red-text {
  color: red;
}</code></pre>
<h3 id="在Taro中给子组件传递属性时，不能使用-…-拓展操作符"><a href="#在Taro中给子组件传递属性时，不能使用-…-拓展操作符" class="headerlink" title="在Taro中给子组件传递属性时，不能使用 … 拓展操作符"></a>在Taro中给子组件传递属性时，不能使用 … 拓展操作符</h3><pre><code class="js">const props = {firstName: &#39;Plus&#39;, lastName: &#39;Second&#39;}
return &lt;Greeting {...props} /&gt; //错误
return &lt;Greeting firstName=&quot;Plus&quot; lastName=&quot;Second&quot; /&gt; //正确</code></pre>
<h3 id="在Taro中如何阻止事件冒泡"><a href="#在Taro中如何阻止事件冒泡" class="headerlink" title="在Taro中如何阻止事件冒泡"></a>在Taro中如何阻止事件冒泡</h3><p>在 Taro 中你不能使用 <code>catchEvent</code> 的方式阻止事件冒泡。你必须明确的使用 <code>e.stopPropagation</code>。例如，阻止事件冒泡你可以这样写：</p>
<pre><code class="js">class Toggle extends Component {
  constructor (props) {
    super(props)
    this.state = {isToggleOn: true}
  }

  onClick = (e) =&gt; {
    e.stopPropagation()
    this.setState(prevState =&gt; ({
      isToggleOn: !prevState.isToggleOn
    }))
  }

  render () {
    return (
      &lt;button onClick={this.onClick}&gt;
        {this.state.isToggleOn ? &#39;ON&#39; : &#39;OFF&#39;}
      &lt;/button&gt;
    )
  }
}</code></pre>
<h3 id="Taro中事件处理的传参方式"><a href="#Taro中事件处理的传参方式" class="headerlink" title="Taro中事件处理的传参方式"></a>Taro中事件处理的传参方式</h3><p>1.使用 <code>bind</code> 方式向监听函数传参，在类组件中定义的监听函数，事件对象 <code>e</code> 要排在所传递参数的后面。</p>
<pre><code class="js">class Popper extends Component {
  constructor () {
    super(...arguments)
    this.state = { name:&#39;Hello world!&#39; }
  }

  // 你可以通过 bind 传入多个参数
  preventPop (name, test, e) {    //事件对象 e 要放在最后
    e.stopPropagation()
  }

  render () {
    return &lt;Button onClick={this.preventPop.bind(this, this.state.name, &#39;test&#39;)}&gt;&lt;/Button&gt;
  }
}
</code></pre>
<p>2.使用<code>匿名函数</code><br>直接写匿名函数不会打乱原有监听函数的参数顺序。<br>注意：在各小程序端，使用匿名函数，尤其是在 <code>循环中</code> 使用匿名函数，比使用 <code>bind</code> 进行事件传参占用更大的内存，速度也会更慢。</p>
<pre><code class="js">class Popper extends Component {
  constructor () {
    super(...arguments)
    this.state = { name: &#39;Hello world!&#39; }
  }

  render () {
    const name = &#39;test&#39;
    return (
      &lt;Button onClick={(e) =&gt; {
        e.stopPropagation()
        this.setState({
          name
        })
      }}&gt;
        {this.state.name}
      &lt;/Button&gt;
    )
  }
}</code></pre>
<p>3.<a href="https://zh.wikipedia.org/wiki/%E6%9F%AF%E9%87%8C%E5%8C%96" target="_blank" rel="noopener">柯里化</a></p>
<pre><code class="js">class Title extends Component{

  handleClick = (index) =&gt; (e) =&gt; {
    e.stopPropagation()
    this.setState({
      currentIndex: index
    })
  }

  render() {
    const { currentIndex } = this.props;
    return (
      {/* 调用 `this.handleClick(currentIndex)` 会返回一个函数，这个函数可以访问到 `currentIndex` 同时也能满足 `onClick` 的签名 */}
      &lt;View onClick={this.handleClick(currentIndex)}&gt;
      &lt;/View&gt;
    )
  }
 }</code></pre>
<p>4.函数式组件传递方式<br>在函数式组件中，事件传参可以传入<code>事件的引用</code>也可以传入<code>匿名函数</code>，以下是函数式组件配合 <code>useCallback</code> 的一个例子：</p>
<pre><code class="js">const App = () =&gt; {
  const [c1, setC1] = useState(0);
  const [c2, setC2] = useState(0);
  const [c3, setC3] = useState(0);

  const increment = c =&gt; c + 1

  // 只有 useCallback 对应的 c1 或 c2 的值改变时，才会返回新的函数
  const increment1 = useCallback(() =&gt; setC1(increment), [c1]);
  const increment2 = useCallback(() =&gt; setC2(increment), [c2]);

  return (&lt;View&gt;
    &lt;Text&gt; Counter 1 is {c1} &lt;/Text&gt;
    &lt;Text&gt; Counter 2 is {c2} &lt;/Text&gt;
    &lt;Text&gt; Counter 3 is {c3} &lt;/Text&gt;
    &lt;View&gt;
      &lt;Button onClick={increment1}&gt;Increment Counter 1&lt;/Button&gt;
      &lt;Button onClick={increment2}&gt;Increment Counter 2&lt;/Button&gt;
      &lt;Button onClick={() =&gt; setC3(increment)}&gt;Increment Counter 3&lt;/Button&gt;
    &lt;/View&gt;
  &lt;/View&gt;)
}</code></pre>
<p>5.任何组件的事件传递都要以 <code>on</code> 开头<br>在 v1.3.0-beta.0 之后，自定义组件间的事件传递可以不用 <code>on</code> 开头，但内置组件的事件依然是以 <code>on</code> 开头的，为了一致性我们仍然推荐你以 <code>on</code> 开头命名你的事件。</p>
<pre><code class="js">const element = &lt;View onClick={this.onTag} /&gt;
const element2 = &lt;Input onFocus={this.onFocus} /&gt;
const element3 = &lt;CustomElement onAnimationEnd={this.props.onAnimationEnd} /&gt;
</code></pre>
<h3 id="Taro中巧用逻辑运算符-amp-amp-和-三元运算符-以及-枚举-来实现条件渲染"><a href="#Taro中巧用逻辑运算符-amp-amp-和-三元运算符-以及-枚举-来实现条件渲染" class="headerlink" title="Taro中巧用逻辑运算符 &amp;&amp; 和 三元运算符 以及 枚举 来实现条件渲染"></a>Taro中巧用逻辑运算符 &amp;&amp; 和 三元运算符 以及 枚举 来实现条件渲染</h3><pre><code class="js">class LoginStatus extends Component {
  render () {
    const isLoggedIn = this.props.isLoggedIn

    return (
      &lt;View&gt;
        {isLoggedIn &amp;&amp; &lt;Text&gt;已登录&lt;/Text&gt;}
        {!isLoggedIn &amp;&amp; &lt;Text&gt;未登录&lt;/Text&gt;}

        {isLoggedIn
            ? &lt;Text&gt;已登录&lt;/Text&gt;
            : &lt;Text&gt;未登录&lt;/Text&gt;
        }

      &lt;/View&gt;
    )
  }
}</code></pre>
<pre><code class="js">function Loading (props) {
  const { loadingText, LOADING_STATUS, loadingStatus, onRetry } = props
  return (
    &lt;View className=&#39;loading-status&#39;&gt;
      {
        {
          &#39;loading&#39;: loadingText,
          &#39;fail&#39;: &lt;View onClick={onRetry}&gt; 加载失败, 点击重试 &lt;/View&gt;,
          &#39;no-more&#39;: &#39;没有更多了&#39;
        }[loadingStatus] /** loadingStatus 是 `loading`、`fail`、`no-more`  其中一种状态 **/
      }
    &lt;/View&gt;
  )
}</code></pre>
<h3 id="Taro中循环渲染-原生小程序组件-需要指定taroKeys"><a href="#Taro中循环渲染-原生小程序组件-需要指定taroKeys" class="headerlink" title="Taro中循环渲染 原生小程序组件 需要指定taroKeys"></a>Taro中循环渲染 原生小程序组件 需要指定taroKeys</h3><p><code>taroKey</code> 适用于循环渲染原生小程序组件，赋予每个元素唯一确定标识，转换为小程序的 <code>wx:key</code>。</p>
<pre><code class="js">const numbers = [...Array(100).keys()] // [0, 1, 2, ..., 98, 99]
const listItems = numbers.map((number) =&gt; {
  return (
    // native component
    &lt;g-list
      taroKey={String(number)}
      className=&#39;g-list&#39;
    &gt;
    我是第 {number + 1} 个数字
    &lt;/g-list&gt;
  )
})</code></pre>

            </div>
            <hr>
            <div>
              <p>
                
                  <span>
                <i class="iconfont icon-inbox"></i>
                    
                      <a class="hover-with-bg" href="/categories/%E6%8A%80%E6%9C%AF/">技术</a>
                      &nbsp;
                    
                  </span>&nbsp;&nbsp;
                
                
                  <span>
                <i class="iconfont icon-tag"></i>
                    
                      <a class="hover-with-bg" href="/tags/%E5%B0%8F%E7%A8%8B%E5%BA%8F/">小程序</a>
                    
                      <a class="hover-with-bg" href="/tags/Taro/">Taro</a>
                    
                  </span>
                
              </p>
              
                <p class="note note-warning">本博客所有文章除特别声明外，均采用 <a href="https://zh.wikipedia.org/wiki/Wikipedia:CC_BY-SA_3.0%E5%8D%8F%E8%AE%AE%E6%96%87%E6%9C%AC" target="_blank" rel="nofollow noopener noopener">CC BY-SA 3.0协议</a> 。转载请注明出处！</p>
              
            </div>

            
              <!-- Comments -->
              <div class="comments" id="comments">
                
                
  <div id="vcomments"></div>
  <script defer src="//cdn1.lncld.net/static/js/3.0.4/av-min.js"></script>
  <script defer src="//unpkg.com/valine/dist/Valine.min.js"></script>

  <script type="text/javascript">
    var notify = 'false' === 'true';
    var verify = 'false' === 'true';
    var oldLoad = window.onload;
    window.onload = function () {
      new Valine({
        el: '#vcomments',
        notify: notify,
        verify: verify,
        app_id: "RVi2nheifsyLgdNUtOODWrEk-gzGzoHsz",
        app_key: "IcQeTY6Y778SNjPL5dwy9JOs",
        placeholder: "说点什么",
        avatar: "/retro",
        meta: ['nick', 'mail', 'link'],
        pageSize: "10",
      });
      oldLoad && oldLoad();
    };
  </script>
  <noscript>Please enable JavaScript to view the <a href="https://valine.js.org" target="_blank" rel="nofollow noopener noopener">comments
      powered by Valine.</a></noscript>


              </div>
            
          </div>
        </div>
      </div>
    </div>
    
      <div class="d-none d-lg-block col-lg-2 toc-container" id="toc-ctn">
        <div id="toc-start"></div>
<div id="toc">
  <p class="h5"><i class="far fa-list-alt"></i>&nbsp;目录</p>
  <div id="tocbot"></div>
</div>

      </div>
    
  </div>
</div>

<!-- Custom -->


    
  </main>

  
    <a class="z-depth-1" id="scroll-top-button" href="#" role="button">
      <i class="fa fa-chevron-up scroll-top-arrow" aria-hidden="true"></i>
    </a>
  

  
    <div class="modal fade" id="modalSearch" tabindex="-1" role="dialog" aria-labelledby="ModalLabel"
     aria-hidden="true">
  <div class="modal-dialog modal-dialog-scrollable modal-lg" role="document">
    <div class="modal-content">
      <div class="modal-header text-center">
        <h4 class="modal-title w-100 font-weight-bold">搜索</h4>
        <button type="button" id="local-search-close" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">&times;</span>
        </button>
      </div>
      <div class="modal-body mx-3">
        <div class="md-form mb-5">
          <input type="text" id="local-search-input" class="form-control validate">
          <label data-error="x" data-success="v"
                 for="local-search-input">关键词</label>
        </div>
        <div class="list-group" id="local-search-result"></div>
      </div>
    </div>
  </div>
</div>
  

  

  

  <footer class="mt-5">
  <div class="text-center py-3">
    <div>
      <a href="https://hexo.io" target="_blank" rel="nofollow noopener"><b>Hexo</b></a>
      <i class="iconfont icon-love"></i>
      <a href="https://github.com/fluid-dev/hexo-theme-fluid" target="_blank" rel="nofollow noopener"> <b>Fluid</b></a>
    </div>
    

    

    
  </div>
</footer>

<!-- SCRIPTS -->
<script  src="https://cdn.staticfile.org/jquery/3.4.1/jquery.min.js" ></script>
<script  src="https://cdn.staticfile.org/popper.js/1.16.1/umd/popper.min.js" ></script>
<script  src="https://cdn.staticfile.org/twitter-bootstrap/4.4.1/js/bootstrap.min.js" ></script>
<script  src="https://cdn.staticfile.org/mdbootstrap/4.13.0/js/mdb.min.js" ></script>
<script  src="/js/main.js" ></script>


  <script  src="/js/lazyload.js" ></script>



  
  <script  src="https://cdn.staticfile.org/tocbot/4.10.0/tocbot.min.js" ></script>
  <script>
    $(document).ready(function () {
      var navHeight = $('#navbar').height();
      var post = $('#post');
      var toc = $('#toc');
      var tocLimMax = post.offset().top + post.height() - navHeight;

      $(window).scroll(function () {
        var tocLimMin = $('#toc-start').offset().top - navHeight;
        var scroH = document.body.scrollTop + document.documentElement.scrollTop;

        if (tocLimMin <= scroH && scroH <= tocLimMax) {
          toc.css({
            'display': 'block',
            'position': 'fixed',
            'top': navHeight,
          });
        } else if (scroH <= tocLimMin) {
          toc.css({
            'position': '',
            'top': '',
          });
        } else if (scroH > tocLimMax) {
          toc.css('display', 'none');
        }
      });
      tocbot.init({
        tocSelector: '#tocbot',
        contentSelector: '.post-content',
        headingSelector: 'h1,h2,h3,h4,h5,h6',
        linkClass: 'tocbot-link',
        activeLinkClass: 'tocbot-active-link',
        listClass: 'tocbot-list',
        isCollapsedClass: 'tocbot-is-collapsed',
        collapsibleClass: 'tocbot-is-collapsible',
        scrollSmooth: true,
      });
      if ($('.toc-list-item').length > 0) {
        $('#toc > p').css('visibility', 'visible');
      }
      var offset = $('#board-ctn').css('margin-right')
      $('#toc-ctn').css({
        'right': offset
      })
    });
  </script>










<!-- Plugins -->



  <script  src="https://cdn.staticfile.org/prettify/188.0.0/prettify.min.js" ></script>
  <script>
    $(document).ready(function () {
      $('pre').addClass('prettyprint  linenums');
      prettyPrint();
    })
  </script>



  <script  src="https://cdn.staticfile.org/typed.js/2.0.11/typed.min.js" ></script>
  <script>
    var typed = new Typed('#subtitle', {
      strings: [
        '  ',
        "Taro 采坑指南&nbsp;",
      ],
      cursorChar: "_",
      typeSpeed: 70,
      loop: false,
    });
    typed.stop();
    $(document).ready(function () {
      $(".typed-cursor").addClass("h2");
      typed.start();
    });
  </script>



  <script  src="https://cdn.staticfile.org/anchor-js/4.2.2/anchor.min.js" ></script>
  <script>
    anchors.options = {
      placement: "right",
      visible: "hover",
      
    };
    var el = "h1,h2,h3,h4,h5,h6".split(",");
    var res = [];
    for (item of el) {
      res.push(".markdown-body > " + item)
    }
    anchors.add(res.join(", "))
  </script>



  <script  src="/js/local-search.js" ></script>
  <script>
    var path = "/local-search.xml";
    var inputArea = document.querySelector("#local-search-input");
    inputArea.onclick = function () {
      getSearchFile(path);
      this.onclick = null
    }
  </script>



  <script defer src="https://cdn.staticfile.org/fancybox/3.5.7/jquery.fancybox.min.js" ></script>
  <script>
    $("#post img:not(.no-zoom img, img[no-zoom])").each(
      function () {
        var element = document.createElement("a");
        $(element).attr("data-fancybox", "images");
        $(element).attr("href", $(this).attr("src"));
        $(this).wrap(element);
      }
    );
  </script>





  
  
    <script>
      !function (e, t, a) {
        function r() {
          for (var e = 0; e < s.length; e++) s[e].alpha <= 0 ? (t.body.removeChild(s[e].el), s.splice(e, 1)) : (s[e].y--, s[e].scale += .004, s[e].alpha -= .013, s[e].el.style.cssText = "left:" + s[e].x + "px;top:" + s[e].y + "px;opacity:" + s[e].alpha + ";transform:scale(" + s[e].scale + "," + s[e].scale + ") rotate(45deg);background:" + s[e].color + ";z-index:99999");
          requestAnimationFrame(r)
        }

        function n() {
          var t = "function" == typeof e.onclick && e.onclick;
          e.onclick = function (e) {
            t && t(), o(e)
          }
        }

        function o(e) {
          var a = t.createElement("div");
          a.className = "heart", s.push({
            el: a,
            x: e.clientX - 5,
            y: e.clientY - 5,
            scale: 1,
            alpha: 1,
            color: c()
          }), t.body.appendChild(a)
        }

        function i(e) {
          var a = t.createElement("style");
          a.type = "text/css";
          try {
            a.appendChild(t.createTextNode(e))
          } catch (t) {
            a.styleSheet.cssText = e
          }
          t.getElementsByTagName("head")[0].appendChild(a)
        }

        function c() {
          return "rgb(" + ~~(255 * Math.random()) + "," + ~~(255 * Math.random()) + "," + ~~(255 * Math.random()) + ")"
        }

        var s = [];
        e.requestAnimationFrame = e.requestAnimationFrame || e.webkitRequestAnimationFrame || e.mozRequestAnimationFrame || e.oRequestAnimationFrame || e.msRequestAnimationFrame || function (e) {
          setTimeout(e, 1e3 / 60)
        }, i(".heart{width: 10px;height: 10px;position: fixed;background: #f00;transform: rotate(45deg);-webkit-transform: rotate(45deg);-moz-transform: rotate(45deg);}.heart:after,.heart:before{content: '';width: inherit;height: inherit;background: inherit;border-radius: 50%;-webkit-border-radius: 50%;-moz-border-radius: 50%;position: fixed;}.heart:after{top: -5px;}.heart:before{left: -5px;}"), n(), r()
      }(window, document);
    </script>
  








</body>
</html>
